import request from '@/router/axios'
import store from '@/store'
import { getLineName,getStationName,getMappingStatus} from "../../../../api/subwayRat/commonCheck";
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  emptyBtn:false,
  align: 'center',
  selection: true,
  reserveSelection:true,
  addBtn: false,
  column: [
  // {
  //   fixed: true,
  //   label: '主键',
  //   prop: 'id',
  //   span: 24,
  //   hide: true
  // }, 
  {
    hide: false,
    width: 100 ,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    search: true,
    filterable : true,
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
    display: true, // 动态显隐控制不能删除
    formatter: function(row, value , label, column){
      return getLineName(value);
    }
  }, {
    hide: false,
    label: '站点',
    width: 180,
    prop: 'stationCode',
    type: 'select',
    search: true,
    filterable : true,
    dicFlag: false,
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
    display: true,// 动态显隐控制不能删除
    formatter: function(row, value , label, column){
      return getStationName(row.lineCode,value);
    }
  },{
    label: '部门',
    width: 120,
    prop: 'deptName',
    search: false,
    hide: false,
    type:'input',
  },{
    label: '发单时间',
    prop: 'transactionTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type: 'date',
    hide: false,
    search: true
  },{
    label: '要求回复时间',
    prop: 'hopeReturnTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 120,
    type: 'date',
    hide: false,
    search: false
  },{
      hide: false,
      width: 70 ,
      search: true,
      label: '事务类别',
      prop: 'transactionType',
      type: 'select',
      props: {
        label: 'label',
        value: 'value'
      },
      dicUrl: "/check/check/getSysDictItemList?type=TRANSACTION_TYPE",
      display: true, // 动态显隐控制不能删除
      formatter:function (row,v) {
        return getMappingStatus('TRANSACTION_TYPE',v);
      }
    },{
    label: '设备类型',
    width: 70,
    prop: 'deviceType',
    type: 'select',
    formatter:function(row, value , label, column){
	  if(value!="" && value!='undefined' && value!=undefined){		  
	    return value == 1?'BOM':'TVM';
	  }
	  return "";
    },   
    dicData: [{
      label: '',
      value: ''
    },{
      label: 'TVM',
      value: '0'
    }, {
      label: 'BOM',
      value: '1'
    }],
    search: true,
    hide: false
  }, {
    label: '设备编号',
    width: 70,
    prop: 'deviceNo',
    search: true,
    hide: false,
  }, {
    label: '卡号',
    width: 70,
    prop: 'cardNumber',
    search: true,
    hide: false,
  }, {
    label: '票种',
    width: 70,
    prop: 'ticketType',
    type: 'select',
    formatter:function(row, value , label, column){
      if(value!="" && value!='undefined' && value!=undefined){
	     return value == 1?'其他票种':'长安通';
	  }
	  return "";
	  
    },
    dicData: [{
      label: '',
      value: ''
    },{
      label: '长安通',
      value: '0'
    }, {
      label: '其他票种',
      value: '1'
    }],
    search: false,
    hide: false,
  }, {
    label: '其他票种',
    width: 70,
    prop: 'otherTicketName',
    search: false,
    hide: false,
  }, {
    hide: false,
    label: '开始时间',
    prop: 'beginTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  }, {
    hide: false,
    label: '结束时间',
    prop: 'endTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  },{
    label: '申请原因',
    width: 70,
    prop: 'applyCase',
    search: false,
    hide: false,
  },  {
    label: '车站排查经过及结果',
    width: 180,
    prop: 'applyDetail',
    search: false,
    hide: true,
  },  {
    label: '反馈结果',
    width: 70,
    prop: 'returnData',
    search: false,
    hide: true,
  },  {
    hide: false,
    label: '反馈时间',
    prop: 'returnTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type:'date',
    search: false
  }, {
    hide: false,
    width: 70,
    label: '反馈人',
    prop: 'returnCreatorName',
    type: 'input',
    search: false
  }, {
    hide: false,
    label: '反馈人工号',
    prop: 'returnCreatorCode',
    width: 100,
    search: false
  }, {
    hide: true,
    display: false,
    label: '车站上传附件',
    prop: 'stationFile',
    formatter:function(row, value , label, column){
      return value == '[]'?'':value;
    },
    width: 120,
    search: false
  }, {
    hide: true,
    //display: false,
    label: '线网上传附件',
    prop: 'lineFile',
    formatter:function(row, value , label, column){
      return value == '[]'?'':value;
    },
    width: 120,
    search: false
  }, {
    hide: false,
    label: '反馈状态',
    prop: 'lineStatus',
    type: 'select',
    formatter:function(row, value , label, column){
      return value == 1?'已回馈':'未回馈';
    },
    dicData: [{
      label: '未回馈',
      value: 0
    }, {
      label: '已回馈',
      value: 1
    }],
    width: 70,
    search: true,
    searchValue: 0
  }]
}
export function getSwStApplyNetworkCheckPassengerAffairs(param) {
  return request({
    url: '/check/check/getSwStApplyNetworkCheckPassengerAffairs',
    method: 'post',
    params: param
  })
}
export function updateSwStApplyNetworkCheckPassengerAffairs(param) {
  return request({
    url: '/check/check/updateSwStApplyNetworkCheckPassengerAffairs',
    method: 'post',
    params: param
  })
}
export function getSysUserToLine(param) {
  return request({
    url: '/check/check/getSysUserToLine',
    method: 'post',
    params: param
  })
}

export function submitFeedback(ids) {
  return request({
    url: '/check/check/submitFeedback',
    method: 'post',
    data: ids
  })
}

